package com.topisv.tms.repository.work;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.topisv.tms.entity.work.WorkBatch;

/**
 * 作业批次_DAO
 * @author ch
 *
 */
public abstract interface WorkBatchDao extends PagingAndSortingRepository<WorkBatch, Long>, JpaSpecificationExecutor<WorkBatch>
{

	@Query("select t from WorkBatch t where t.batchCode=?")
	WorkBatch loadbatchByBatchCode(String WorkBatchCode);

	@Modifying
	@Query("update WorkBatch t set t.status=?2 where t.batchCode=?1")
	void updateStatus(String batchCode, String status);
	
	@Modifying
	@Query("update WorkBatch t set t.syncStatus=?2 where t.batchCode=?1")
	void updateSyncStatus(String batchCode, String status);

}